All sites and drugs

Drug A

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001002
ETS(quantity ~ season(method = “N”)) l 162.3565708

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 17.63355 0.0614688
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 0.6160404 0.1679878 3.667174 0.0002858
ARIMA(quantity) ma1 -0.6055922 0.1698636 -3.565169 0.0004173
ARIMA(quantity) ma2 0.1340922 0.0598298 2.241227 0.0256759
ARIMA(quantity) sar1 0.0981877 0.0639542 1.535283 0.1256726
ARIMA(quantity) constant 56.3162905 3.3440977 16.840504 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 6.277749 0.7914132
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -17.955 99.947 88.679 -Inf Inf 0.71325
ETS(quantity ~ season(method = “N”)) Test -10.876 104.840 91.000 -Inf Inf 0.73192
FASSTER(quantity ~ trend(1)) Test 45.033 113.580 91.000 -Inf Inf 0.73192
prophet(quantity) Test 12.226 105.350 101.280 -Inf Inf 0.81459
SNAIVE(quantity) Test -92.667 122.390 104.330 -Inf Inf 0.83916
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -1.0351 54.794 36.070 -Inf Inf 1.05120
ETS(quantity ~ season(method = “A”)) Test -1.9517 56.102 35.553 -Inf Inf 1.03620
FASSTER(quantity ~ trend(1) + fourier(7)) Test -17.4840 58.755 45.809 -Inf Inf 1.33510
prophet(quantity ~ season(7)) Test -2.5801 55.874 35.886 NaN Inf 1.04580
SNAIVE(quantity ~ lag(“week”)) Test -2.3333 57.196 25.667 -Inf Inf 0.74802
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -12.8141644 124.7169 102.8665 -Inf Inf 0.8375329 -0.2324731
ETS(quantity ~ season(method = “N”)) Test -4.5191525 123.5376 100.5418 -Inf Inf 0.8186048 -0.1909788
FASSTER(quantity ~ trend(1)) Test -65.0342019 144.0960 123.1841 -Inf Inf 1.0029574 -0.0393517
prophet(quantity) Test -5.5127510 140.7218 115.9168 -Inf Inf 0.9437876 0.0352620
SNAIVE(quantity) Test -0.1666667 166.2477 130.7917 -Inf Inf 1.0648975 0.0135623
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -12.151161 38.60934 28.46236 -Inf Inf 0.8242388 -0.0531722
ETS(quantity ~ season(method = “A”)) Test -15.265937 37.59509 28.07931 -Inf Inf 0.8131461 -0.0773882
FASSTER(quantity ~ trend(1) + fourier(7)) Test 8.258277 35.16723 20.55201 NaN Inf 0.5951637 -0.0782716
prophet(quantity ~ season(7)) Test -17.672399 38.66555 30.13475 -Inf Inf 0.8726694 -0.0839118
SNAIVE(quantity ~ lag(“week”)) Test -5.333333 56.33235 25.33333 -Inf Inf 0.7336256 -0.0092600

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001
ETS(quantity ~ season(method = “N”)) l 2018.9770

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 271.4111 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.5644956 0.0443110 -35.307164 0.0000000
ARIMA(quantity) ma2 0.5815256 0.0442398 13.144845 0.0000000
ARIMA(quantity) sma1 0.1117924 0.0564947 1.978812 0.0486708

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 56.09459 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -269.200 1095.30 815.82 -74.093 93.163 1.3412
ETS(quantity ~ season(method = “N”)) Test -237.780 908.66 722.17 -61.588 78.739 1.1873
FASSTER(quantity ~ trend(1)) Test -101.730 882.88 722.17 -50.728 73.447 1.1873
prophet(quantity) Test -191.960 921.73 739.09 -60.481 81.026 1.2151
SNAIVE(quantity) Test 10.833 1837.60 1650.20 -83.329 150.260 2.7130
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -36.0820 434.43 347.90 -Inf Inf 0.96973
ETS(quantity ~ season(method = “A”)) Test -8.8812 408.04 282.32 NaN Inf 0.78695
FASSTER(quantity ~ trend(1) + fourier(7)) Test 235.1800 531.75 379.76 NaN Inf 1.05850
prophet(quantity ~ season(7)) Test -5.4564 478.04 327.23 NaN Inf 0.91214
SNAIVE(quantity ~ lag(“week”)) Test 185.2100 479.98 262.02 -Inf Inf 0.73037
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 141.9050 1119.897 935.5436 -81.45248 116.5322 1.562056 -0.3900158
ETS(quantity ~ season(method = “N”)) Test 130.9735 1035.014 863.4654 -84.11084 115.2071 1.441709 -0.3069377
FASSTER(quantity ~ trend(1)) Test 175.0720 1101.875 948.1003 -80.17792 116.6875 1.583022 -0.2019976
prophet(quantity) Test 179.1003 1071.280 899.2753 -85.09568 119.3850 1.501500 -0.2554177
SNAIVE(quantity) Test 190.6875 1307.670 1035.2292 -69.98942 113.6331 1.728499 -0.3973729
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -6.314599 514.8799 362.1752 -Inf Inf 1.0099517 -0.0644588
ETS(quantity ~ season(method = “A”)) Test -32.049368 491.9708 336.1137 -Inf Inf 0.9372774 -0.0991452
FASSTER(quantity ~ trend(1) + fourier(7)) Test -132.485406 513.9743 391.2897 -Inf Inf 1.0911394 -0.0873330
prophet(quantity ~ season(7)) Test -12.180340 491.2121 322.2710 NaN Inf 0.8986758 -0.0957201
SNAIVE(quantity ~ lag(“week”)) Test -148.500000 611.1046 437.1667 -Inf Inf 1.2190708 -0.2450742

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001
ETS(quantity ~ season(method = “N”)) l 3297.9622

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 159.7713 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.5802277 0.0421181 -37.519010 0
ARIMA(quantity) ma2 0.6097934 0.0439426 13.877053 0
ARIMA(quantity) sma1 0.3502639 0.0583689 6.000861 0

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 64.2106 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -160.180 1592.4 1351.3 -40.251 63.339 1.6235
ETS(quantity ~ season(method = “N”)) Test 14.938 1447.0 1225.5 -29.304 53.342 1.4723
FASSTER(quantity ~ trend(1)) Test -183.680 1458.5 1291.7 -37.091 58.562 1.5519
prophet(quantity) Test 102.970 1472.1 1256.2 -25.067 51.408 1.5093
SNAIVE(quantity) Test 10.667 2195.8 1868.0 -48.360 90.024 2.2443
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -21.0540 707.47 528.15 -Inf Inf 1.24260
ETS(quantity ~ season(method = “A”)) Test -6.1685 653.88 438.91 -Inf Inf 1.03260
FASSTER(quantity ~ trend(1) + fourier(7)) Test 354.1400 728.82 461.54 Inf Inf 1.08590
prophet(quantity ~ season(7)) Test 9.1109 638.21 422.53 NaN Inf 0.99407
SNAIVE(quantity ~ lag(“week”)) Test 303.1900 724.97 387.52 -40.53 142.2 0.91172
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 101.68153 1070.105 878.7796 -15.151884 38.97492 1.068348 -0.5428149
ETS(quantity ~ season(method = “N”)) Test 27.84641 1073.538 864.4255 -19.045617 40.06804 1.050897 -0.4386608
FASSTER(quantity ~ trend(1)) Test 211.68458 1216.285 1029.0467 -13.243619 43.34534 1.251030 -0.1285904
prophet(quantity) Test 255.93076 1132.394 972.9201 -10.244049 39.91888 1.182796 -0.3406090
SNAIVE(quantity) Test 213.60417 1414.393 1084.1875 -9.827629 42.51235 1.318065 -0.5216012
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 62.90364 669.9151 489.9540 -Inf Inf 1.1646896 0.0627889
ETS(quantity ~ season(method = “A”)) Test 69.48203 626.7777 406.4979 -Inf Inf 0.9663026 -0.0031281
FASSTER(quantity ~ trend(1) + fourier(7)) Test 164.92504 645.2205 428.8795 NaN Inf 1.0195069 -0.0123546
prophet(quantity ~ season(7)) Test 87.19625 626.9062 410.7530 NaN Inf 0.9764176 -0.0117592
SNAIVE(quantity ~ lag(“week”)) Test 86.45238 646.5062 365.5000 -Inf Inf 0.8688448 -0.2836529

Drug B

Drug B is excluded from this analysis because there is only 3 years of data for Drug B. It may be included at a later date.

Drug C

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0412606
ETS(quantity ~ season(method = “N”)) l 0.2623830

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 17.77709 0.0588423
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.0701466 0.0586881 -1.195245 0.2328629
ARIMA(quantity) ma1 -0.9615223 0.0226335 -42.482203 0.0000000
ARIMA(quantity) constant 0.0026204 0.0018765 1.396437 0.1635358

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 16.57448 0.084326
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.2857800 0.46890 0.28578 19.2700 19.270 0.39684
ETS(quantity ~ season(method = “N”)) Test 0.2930300 0.47409 0.29303 19.9170 19.917 0.40691
FASSTER(quantity ~ trend(1)) Test -0.1147500 0.38994 0.35428 -17.4630 29.439 0.49195
prophet(quantity) Test 0.0088599 0.40518 0.28532 -6.4686 21.178 0.39620
SNAIVE(quantity) Test 0.3333300 0.81650 0.66667 25.0000 58.333 0.92573
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.181280 0.34152 0.18128 Inf Inf 1.3962
ETS(quantity ~ season(method = “A”)) Test -0.042226 0.28420 0.18607 -Inf Inf 1.4331
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.081532 0.29093 0.22693 -Inf Inf 1.7478
prophet(quantity ~ season(7)) Test -0.052164 0.28547 0.20376 -Inf Inf 1.5694
SNAIVE(quantity ~ lag(“week”)) Test -0.047619 0.43644 0.19048 -Inf Inf 1.4671
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.0075191 1.084065 0.7801328 -Inf Inf 1.083293 -0.0314451
ETS(quantity ~ season(method = “N”)) Test 0.0083423 1.077461 0.7662528 -Inf Inf 1.064019 -0.0501597
FASSTER(quantity ~ trend(1)) Test -0.0477061 1.151219 0.8402641 -Inf Inf 1.166792 0.0617464
prophet(quantity) Test -0.1224827 1.084903 0.8279418 -Inf Inf 1.149681 -0.0282379
SNAIVE(quantity) Test -0.0833333 1.443376 1.0416667 -Inf Inf 1.446459 -0.0527453
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 0.1719968 0.4660033 0.1752919 NaN Inf 1.402975 0.0022768
ETS(quantity ~ season(method = “A”)) Test 0.0523478 0.4336203 0.2286735 NaN Inf 1.830222 -0.0152852
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.0782281 0.4285844 0.2167827 -Inf Inf 1.735053 -0.0204113
prophet(quantity ~ season(7)) Test 0.0368933 0.4246549 0.2472935 -Inf Inf 1.979250 -0.0197295
SNAIVE(quantity ~ lag(“week”)) Test 0.0238095 0.5976143 0.3095238 -Inf Inf 2.477320 -0.0668105

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0510261
ETS(quantity ~ season(method = “N”)) l 0.6459055

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 35.51043 0.0001021
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 1.1085028 0.1568118 7.0689995 0.0000000
ARIMA(quantity) ar2 -0.4439474 0.2239199 -1.9826172 0.0482493
ARIMA(quantity) ma1 -1.2208366 0.1353474 -9.0200206 0.0000000
ARIMA(quantity) ma2 0.6463738 0.2013875 3.2096017 0.0014614
ARIMA(quantity) sar1 -0.4753740 1.3922863 -0.3414341 0.7329968
ARIMA(quantity) sma1 0.5272700 1.3715643 0.3844296 0.7009107
ARIMA(quantity) constant 0.3615233 0.0356792 10.1325938 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 23.10871 0.0103524
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.049325 0.51020 0.49213 -Inf Inf 0.49959
ETS(quantity ~ season(method = “N”)) Test -0.018531 0.47177 0.43827 -Inf Inf 0.44491
FASSTER(quantity ~ trend(1)) Test 0.507720 0.69282 0.61368 -Inf Inf 0.62298
prophet(quantity) Test 0.298750 0.57032 0.55387 -Inf Inf 0.56226
SNAIVE(quantity) Test 0.333330 0.81650 0.66667 -Inf Inf 0.67677
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.0141270 0.32413 0.19897 -Inf Inf 1.04670
ETS(quantity ~ season(method = “A”)) Test 0.0241040 0.31001 0.18325 NaN Inf 0.96402
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.0630860 0.31443 0.24194 -Inf Inf 1.27270
prophet(quantity ~ season(7)) Test 0.0084737 0.30592 0.18700 NaN Inf 0.98370
SNAIVE(quantity ~ lag(“week”)) Test -0.0238100 0.51177 0.26190 -Inf Inf 1.37780
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.0924686 1.029245 0.8001087 -Inf Inf 0.8122315 0.0072850
ETS(quantity ~ season(method = “N”)) Test -0.1648498 1.146186 0.9063780 -Inf Inf 0.9201110 0.1682406
FASSTER(quantity ~ trend(1)) Test -0.0580629 1.186955 0.8890300 -Inf Inf 0.9025001 0.2119620
prophet(quantity) Test 0.0939788 1.081651 0.7825832 -Inf Inf 0.7944405 0.0620541
SNAIVE(quantity) Test 0.0000000 1.457738 1.0000000 -Inf Inf 1.0151515 0.2843137
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.0582267 0.2207598 0.1433771 -Inf Inf 0.7468548 -0.0512831
ETS(quantity ~ season(method = “A”)) Test -0.0648977 0.2180195 0.1415660 NaN Inf 0.7374211 -0.0306467
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.0639730 0.2168716 0.1039410 NaN Inf 0.5414313 -0.0294029
prophet(quantity ~ season(7)) Test -0.0749898 0.2173256 0.1490010 NaN Inf 0.7761499 -0.0176000
SNAIVE(quantity ~ lag(“week”)) Test 0.0476190 0.2182179 0.0476190 100 100 0.2480489 -0.0511905

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0550134
ETS(quantity ~ season(method = “N”)) l 4.2467197

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 87.48554 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.9658588 0.0355692 -27.1543820 0.0000000
ARIMA(quantity) ma1 0.0059256 0.0441196 0.1343079 0.8932412
ARIMA(quantity) ma2 -0.8966608 0.0426436 -21.0268672 0.0000000
ARIMA(quantity) sar1 0.0653839 0.0596098 1.0968645 0.2735028
ARIMA(quantity) sar2 0.1455756 0.0702639 2.0718414 0.0390591
ARIMA(quantity) constant -0.0100556 0.0123544 -0.8139305 0.4162735

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 83.59398 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.64151 2.4227 1.7647 -Inf Inf 0.79338
ETS(quantity ~ season(method = “N”)) Test 0.48847 2.4071 1.7184 -Inf Inf 0.77256
FASSTER(quantity ~ trend(1)) Test 1.62290 2.8617 2.0965 -Inf Inf 0.94257
prophet(quantity) Test 0.61216 2.5062 2.0342 -Inf Inf 0.91454
SNAIVE(quantity) Test 0.16667 3.1885 2.8333 -Inf Inf 1.27380
Daily data
## Warning in sqrt(diag(best$var.coef)): NaNs produced

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.105980 0.74299 0.42298 -Inf Inf 0.67971
ETS(quantity ~ season(method = “A”)) Test 0.034746 0.71316 0.40522 NaN Inf 0.65117
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.269390 0.78786 0.55025 -Inf Inf 0.88424
prophet(quantity ~ season(7)) Test 0.053329 0.74303 0.47984 NaN Inf 0.77109
SNAIVE(quantity ~ lag(“week”)) Test 0.023810 0.74001 0.40476 -Inf Inf 0.65044
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.0615136 1.650035 1.305759 -Inf Inf 0.5851895 -0.1543366
ETS(quantity ~ season(method = “N”)) Test 0.0265369 1.538735 1.189461 -Inf Inf 0.5330693 -0.2000109
FASSTER(quantity ~ trend(1)) Test 0.0922926 1.721218 1.435999 -Inf Inf 0.6435579 -0.0389326
prophet(quantity) Test 0.7740712 1.798016 1.364955 -Inf Inf 0.6117188 -0.1245546
SNAIVE(quantity) Test 0.2708333 2.155419 1.645833 -Inf Inf 0.7375975 -0.1637894
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.1017775 0.4850811 0.4269597 -Inf Inf 0.6775128 0.0097210
ETS(quantity ~ season(method = “A”)) Test -0.0863789 0.4413631 0.3468492 -Inf Inf 0.5503909 -0.0543017
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.3537661 0.6193490 0.5071441 -Inf Inf 0.8047519 -0.0021417
prophet(quantity ~ season(7)) Test -0.0310719 0.5113278 0.4371493 NaN Inf 0.6936819 0.0018050
SNAIVE(quantity ~ lag(“week”)) Test -0.1904762 0.5773503 0.3333333 -Inf Inf 0.5289436 0.1802981

Drug D

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.1177532
ETS(quantity ~ season(method = “N”)) l 7.9912120

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 35.48464 0.0001032
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -0.8780575 0.0323965 -27.1034327 0.0000000
ARIMA(quantity) sar1 0.0354841 0.0786125 0.4513799 0.6520441

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 36.34574 7.34e-05
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 3.9053 11.142 5.1743 -Inf Inf 0.49484
ETS(quantity ~ season(method = “N”)) Test 3.7817 11.099 5.2566 -Inf Inf 0.50272
FASSTER(quantity ~ trend(1)) Test 4.6667 11.431 4.6667 -Inf Inf 0.44630
prophet(quantity) Test -4.6423 10.117 9.3066 -Inf Inf 0.89004
SNAIVE(quantity) Test 4.6667 11.431 4.6667 100 100 0.44630
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 0.63313 4.3154 0.69861 -Inf Inf 0.42239
ETS(quantity ~ season(method = “A”)) Test 0.62472 4.3894 1.23170 NaN Inf 0.74473
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.37721 4.3587 1.29820 NaN Inf 0.78492
prophet(quantity ~ season(7)) Test 0.40451 4.3524 1.32570 NaN Inf 0.80155
SNAIVE(quantity ~ lag(“week”)) Test 0.66667 4.3205 0.66667 100 100 0.40308
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -2.1289946 11.38355 8.513096 -Inf Inf 0.8059335 0.5991547
ETS(quantity ~ season(method = “N”)) Test -2.6259821 12.95669 9.054866 -Inf Inf 0.8572228 0.6357883
FASSTER(quantity ~ trend(1)) Test -2.0161909 13.80218 8.287724 -Inf Inf 0.7845976 0.6142209
prophet(quantity) Test 3.1673360 10.36205 6.322520 NaN Inf 0.5985520 0.5217602
SNAIVE(quantity) Test 0.3666667 12.70827 5.300000 -Inf Inf 0.5017502 0.0532605
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -0.0893772 0.0893787 0.0893772 -Inf Inf 0.0525763 0.0363889
ETS(quantity ~ season(method = “A”)) Test -0.0719456 0.7260574 0.5607913 NaN Inf 0.3298861 0.2397081
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.0982023 0.7376932 0.6125365 NaN Inf 0.3603253 0.2392553
prophet(quantity ~ season(7)) Test -0.4127489 0.8614791 0.7291816 NaN Inf 0.4289418 0.2948788
SNAIVE(quantity ~ lag(“week”)) Test 0.0000000 0.0000000 0.0000000 NaN NaN 0.0000000 NaN

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0807574
ETS(quantity ~ season(method = “N”)) l 17.8629306

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 26.27242 0.0033906
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.1995096 0.0747021 -2.670737 0.0079493
ARIMA(quantity) ma1 -0.8003094 0.0616738 -12.976498 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 16.76456 0.0797388
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 11.6770 18.153 13.893 -Inf Inf 0.43867
ETS(quantity ~ season(method = “N”)) Test 7.0046 15.509 13.833 -Inf Inf 0.43677
FASSTER(quantity ~ trend(1)) Test 13.7510 19.508 13.833 -Inf Inf 0.43677
prophet(quantity) Test 9.9557 15.389 12.851 NaN Inf 0.40574
SNAIVE(quantity) Test 4.5000 19.803 14.167 -Inf Inf 0.44730
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 1.7259 8.3257 3.3840 -Inf Inf 0.64965
ETS(quantity ~ season(method = “A”)) Test 2.1609 8.6052 4.3626 NaN Inf 0.83752
FASSTER(quantity ~ trend(1) + fourier(7)) Test 1.9376 8.5445 4.4014 NaN Inf 0.84498
prophet(quantity ~ season(7)) Test 1.7174 8.5985 4.5187 NaN Inf 0.86749
SNAIVE(quantity ~ lag(“week”)) Test 2.6429 8.5649 2.6429 100 100 0.50737
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test 3.909257 16.10149 12.45077 NaN Inf 0.3931205 0.1871885
ETS(quantity ~ season(method = “N”)) Test 1.404502 15.58327 12.80260 -Inf Inf 0.4042292 0.2580917
FASSTER(quantity ~ trend(1)) Test 4.778155 16.04366 11.23543 -Inf Inf 0.3547474 0.2507581
prophet(quantity) Test 3.947609 21.85388 15.53651 NaN Inf 0.4905495 0.5759967
SNAIVE(quantity) Test 1.583333 29.88101 14.54167 -Inf Inf 0.4591384 0.1209607
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -1.5823089 1.582480 1.582309 -Inf Inf 0.2973949 0.8575486
ETS(quantity ~ season(method = “A”)) Test -1.1804705 2.455482 2.242985 NaN Inf 0.4215688 0.4013534
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.6727588 2.271434 1.665238 NaN Inf 0.3129813 0.3924931
prophet(quantity ~ season(7)) Test -1.4829513 2.628925 2.306418 NaN Inf 0.4334912 0.3890467
SNAIVE(quantity ~ lag(“week”)) Test 0.0000000 0.000000 0.000000 NaN NaN 0.0000000 NaN

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0532616
ETS(quantity ~ season(method = “N”)) l 107.9514229

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 54.70743 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.8631315 0.0787298 -10.9632122 0.0000000
ARIMA(quantity) ma1 0.0236562 0.0936657 0.2525604 0.8007671
ARIMA(quantity) ma2 -0.7615099 0.0822297 -9.2607650 0.0000000
ARIMA(quantity) ma3 -0.1759554 0.0590797 -2.9782710 0.0031161
ARIMA(quantity) sar1 0.0159874 0.0590524 0.2707316 0.7867688
ARIMA(quantity) sar2 0.1144626 0.0674947 1.6958748 0.0908643

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 37.74725 4.2e-05
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test -37.0820 39.045 37.0820 -Inf Inf 0.68225
ETS(quantity ~ season(method = “N”)) Test -41.1820 42.508 41.1820 -Inf Inf 0.75768
FASSTER(quantity ~ trend(1)) Test -6.4169 12.250 12.0560 -Inf Inf 0.22180
prophet(quantity) Test -5.6451 12.873 9.8279 NaN Inf 0.18082
SNAIVE(quantity) Test -28.0000 48.497 37.3330 -Inf Inf 0.68687
Daily data

.model .type ME RMSE MAE MPE MAPE MASE
ARIMA(quantity) Test 2.27100 9.7607 2.2710 Inf Inf 0.17621
ETS(quantity ~ season(method = “A”)) Test -3.40430 11.0670 7.0533 NaN Inf 0.54725
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.96906 11.7240 8.0877 NaN Inf 0.62751
prophet(quantity ~ season(7)) Test -2.58400 11.9220 8.2236 NaN Inf 0.63805
SNAIVE(quantity ~ lag(“week”)) Test 2.00000 9.6609 2.0000 100 100 0.15518
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -3.8681462 37.93263 32.35715 -Inf Inf 0.5942380 0.3955366
ETS(quantity ~ season(method = “N”)) Test -3.9285852 37.50104 31.85796 -Inf Inf 0.5850705 0.3922062
FASSTER(quantity ~ trend(1)) Test 0.0330934 34.85186 27.56318 -Inf Inf 0.5061970 0.3145006
prophet(quantity) Test 5.5815139 41.67960 32.01539 NaN Inf 0.5879616 0.4212981
SNAIVE(quantity) Test -3.5000000 59.67132 44.33333 -Inf Inf 0.8141803 0.4159235
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE ACF1
ARIMA(quantity) Test -40.378875 41.384168 40.378875 -Inf Inf 3.0791736 0.0041697
ETS(quantity ~ season(method = “A”)) Test -4.766195 9.703612 7.659677 -Inf Inf 0.5841043 -0.0681954
FASSTER(quantity ~ trend(1) + fourier(7)) Test -11.052605 15.195554 13.074809 -Inf Inf 0.9970463 0.0831263
prophet(quantity ~ season(7)) Test -3.372669 11.116702 8.864495 NaN Inf 0.6759802 0.0776819
SNAIVE(quantity ~ lag(“week”)) Test -5.333333 22.861904 10.666667 -Inf Inf 0.8134084 -0.1200754